package com.cqc.datetimepicker02;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.CalendarView;

/**
 * Created by cui on 2016/11/5.
 */

public class CalendarViewActivity extends AppCompatActivity {
    private Context context = this;
    private CalendarView calendarView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calendarview);
        calendarView = (CalendarView) findViewById(R.id.calendarView);
        calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
            @Override
            public void onSelectedDayChange(CalendarView calendarView, int year, int month, int day) {
                ToastUtil.showShortToast(context, "您选择的日期是：" + year + "年" + (month + 1) + "月" + day + "日");
            }
        });
    }
}
